<?php
$option		= mosGetParam($_REQUEST, 'option', '');
$task		= mosGetParam($_REQUEST, 'task', '');
$id			= intval(mosGetParam($_REQUEST, 'id', 0));
$url 		= $mosConfig_live_site."/administrator/components/com_content/uploads/";

if ($task=='blogsection' && $option=='com_content'){
	$sql = "SELECT id FROM #__sections WHERE id=".$id;
	$database->setQuery($sql);
	$database->loadObject($field);
	$sectionID = $field->id;
	$sql = "SELECT title FROM #__sections WHERE id!=".$id." AND id!=3";
	$database->setQuery($sql);
	$database->loadObject($secname);
	
	$titleNameSec = $secname->title;
	$where = " AND sectionid NOT IN(".$sectionID.",3)";
}
else if ($task=='view' && $option=='com_content'){
	$sql = "SELECT sectionid FROM #__content WHERE id=".$id;
	$database->setQuery($sql);
	$database->loadObject($field);
	$sectionID = $field->sectionid;
	$sql = "SELECT title FROM #__sections WHERE id!=".$sectionID." AND id!=3";
	$database->setQuery($sql);
	$database->loadObject($secname);
	
	$titleNameSec = $secname->title;
	$where = " AND sectionid NOT IN(".$sectionID.",3)";
}else{
	$titleNameSec = "Dự án bất động sản";
	$where = " AND sectionid NOT IN(2,3)";
}
$sql = "SELECT id,catid,title,introtext,img FROM #__content WHERE state=1".$where." AND catid!=0 ORDER BY ordering ASC, id DESC LIMIT 0,5";
$database->setQuery($sql);
$lsOtherList = $database->loadObjectList();
?>
<div class="sangiaodich"><?php echo $titleNameSec;?></div>
<?php 
for ($i=0; $i<count($lsOtherList); $i++){
$link = "index.php?option=com_content&task=view&catid=".$lsOtherList[$i]->catid."&id=".$lsOtherList[$i]->id;	
?>
<div class="lsProject">
	<div class="list"><a href="<?php echo $link;?>"><?php echo $lsOtherList[$i]->title;?></a></div>
	<div class="list">
		<?php
		if ($lsOtherList[$i]->img!=''){
		?>
		<a href="<?php echo $link;?>"><img src="<?php echo $url.$lsOtherList[$i]->img;?>" width="185" border="0" /></a>
		<?php
		}else{
		?>
		<a href="<?php echo $link;?>"><img src="<?php echo $url;?>no_pic.gif" width="185" border="0" /></a>
		<?php
		}
		?>
	</div>
	<div class="list"><?php echo $lsOtherList[$i]->introtext;?></div>
	<div class="list_detail"><a href="<?php echo $link;?>">Chi tiết</a></div>
</div>
<?php }?>
